local _M = {}


-- faster then setmetatable(_M, {__index = _G})
local type = type        
local tonumber = tonumber

-- setmetatable(_M, {__index = _G})

setfenv(1, _M)

function new(r, i)
  return {r=r, i=i}
end

function add(c1, c2)
  return {r=c1.r+ c2.r, i=c1.i + c2.i}
end

function check(c)
  return type(c)=='table' and tonumber(c.r) and tonumber(c.i)
end

function info(c)
  return 'real=' .. c.r ..', image=' .. c.i
end

_M.new = new
_M.add = add
_M.info = info

return _M


